const Generator = require('yeoman-generator')

module.exports = class extends Generator {
    prompting() {
        return this.prompt([{
                type: 'input',
                name: 'name',
                message: 'project name',
                default: this.appname
            }]
        )
            .then(answers => {
                this.answers = answers
            })
    }

    writing() {
        const fileArr = [
            'browserslist',
            '.editorconfig',
            'angular.json',
            'karma.conf.js',
            'package.json',
            'README.md',
            'tsconfig.json',
            'tsconfig.app.json',
            'tsconfig.spec.json',
            'tslint.json',
            'src/main.ts',
            'src/polyfills.ts',
            'src/test.ts',
            'src/theme.less',
            'src/styles.less',
            'src/index.html',
            'src/favicon.ico',
            'src/assets/html/testLogin.html',
            'src/environments/environment.ts',
            'src/environments/environment.prod.ts',
            'src/app/app-routing.module.ts',
            'src/app/app.component.html',
            'src/app/app.component.less',
            'src/app/app.component.spec.ts',
            'src/app/app.component.ts',
            'src/app/app.module.ts',
            'src/app/shared/component.module.ts',
            'src/app/core/constants/global.constants.ts',
            'src/app/core/constants/menu-header.contstants.ts',
            'src/app/core/constants/menu-list.contstants.ts',
            'src/app/core/services/data.service.ts',
            'src/app/core/services/jwt-decode.service.ts',
            'src/app/core/services/page-log.service.ts',
            'src/app/core/services/user-info.ts',
            'src/app/pages/world/world-routing.module.ts',
            'src/app/pages/world/world.component.html',
            'src/app/pages/world/world.component.less',
            'src/app/pages/world/world.component.ts',
            'src/app/pages/world/world.module.ts',
            'src/app/shared/directives/scroll.directive.ts',
            'src/app/shared/directives/spy.directive.ts',
            'src/app/shared/http-interceptor/auth-interceptor.ts',
            'src/app/shared/http-interceptor/config.ts',
            'src/app/shared/http-interceptor/response-interceptor.ts',
            'src/app/shared/router-guards/access-in.guard.ts',
            'src/app/pages/world/blank/blank.component.html',
            'src/app/pages/world/blank/blank.component.spec.ts',
            'src/app/pages/world/blank/blank.component.ts',
            'src/app/pages/world/home/home.component.html',
            'src/app/pages/world/blank/blank.component.less',
            'src/app/pages/world/home/home.component.spec.ts',
            'src/app/pages/world/home/home.component.ts',
            'src/app/pages/world/home/home.component.less',
            'src/app/shared/component/entrance/entrance.component.html',
            'src/app/shared/component/entrance/entrance.component.spec.ts',
            'src/app/shared/component/entrance/entrance.component.ts',
            'src/app/shared/component/entrance/entrance.component.less',
            'src/app/shared/component/error-page/error-page.component.html',
            'src/app/shared/component/error-page/error-page.component.spec.ts',
            'src/app/shared/component/error-page/error-page.component.less',
            'src/app/shared/component/error-page/error-page.component.ts',
            'src/app/shared/component/footer/footer.component.html',
            'src/app/shared/component/footer/footer.component.less',
            'src/app/shared/component/footer/footer.component.spec.ts',
            'src/app/shared/component/footer/footer.component.ts',
            'src/app/shared/component/header/header.component.html',
            'src/app/shared/component/header/header.component.less',
            'src/app/shared/component/header/header.component.spec.ts',
            'src/app/shared/component/header/header.component.ts',
            'src/app/shared/component/layout/layout.component.html',
            'src/app/shared/component/layout/layout.component.less',
            'src/app/shared/component/layout/layout.component.spec.ts',
            'src/app/shared/component/layout/layout.component.ts',
            'src/app/shared/component/layout-menu/layout-menu.component.html',
            'src/app/shared/component/layout-menu/layout-menu.component.less',
            'src/app/shared/component/layout-menu/layout-menu.component.spec.ts',
            'src/app/shared/component/layout-menu/layout-menu.component.ts',
            'src/app/shared/component/lock-page/lock-page.component.html',
            'src/app/shared/component/lock-page/lock-page.component.spec.ts',
            'src/app/shared/component/lock-page/lock-page.component.ts',
            'src/app/shared/component/menu/menu.component.html',
            'src/app/shared/component/menu/menu.component.less',
            'src/app/shared/component/menu/menu.component.spec.ts',
            'src/app/shared/component/lock-page/lock-page.component.less',
            'src/app/shared/component/menu/menu.component.ts',
            'src/app/shared/component/notfound-page/notfound-page.component.html',
            'src/app/shared/component/notfound-page/notfound-page.component.spec.ts',
            'src/app/shared/component/notfound-page/notfound-page.component.ts',
            'src/app/shared/component/notfound-page/notfound-page.component.less',
            'src/app/shared/component/notice/notice.component.html',
            'src/app/shared/component/notice/notice.component.less',
            'src/app/shared/component/notice/notice.component.spec.ts',
            'src/app/shared/component/notice/notice.component.ts',
            'src/app/shared/component/outoftime-page/outoftime-page.component.html',
            'src/app/shared/component/outoftime-page/outoftime-page.component.spec.ts',
            'src/app/shared/component/outoftime-page/outoftime-page.component.ts',
            'src/app/shared/component/schedule/schedule.component.html',
            'src/app/shared/component/schedule/schedule.component.less',
            'src/app/shared/component/outoftime-page/outoftime-page.component.less',
            'src/app/shared/component/schedule/schedule.component.spec.ts',
            'src/app/shared/component/schedule/schedule.component.ts',
        ]
        fileArr.forEach(item=>{
            this.fs.copyTpl(
                this.templatePath(item),
                this.destinationPath(item),
                this.answers
            )
        })
    }
}
